<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/index.xhtml">
        <ui:define name="title"/>
        <ui:define name="body">

            <h:form>

                <p:panel id="panel" header="#{bundle.CreateTblPrestamoTitle}" style="margin-bottom:5px;">
                    <h:panelGroup id="messagePanel" layout="block">
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                    </h:panelGroup>

                    <h:panelGrid columns="3" cellpadding="3">

                        <p:outputLabel value="#{bundle.CreateTblPrestamoLabel_tblNatilleraPersona}" for="tblNatilleraPersona" />
                        <p:selectOneMenu id="tblNatilleraPersona" value="#{tblPrestamoController.selected.tblNatilleraPersona}" required="true" requiredMessage="#{bundle.CreateTblPrestamoRequiredMessage_tblNatilleraPersona}">
                            <h:selectOneMenu title="#{bundle.CreateTblPrestamoTitle_tblNatilleraPersona}"/>
                            <f:selectItems value="#{tblNatilleraPersonaController.itemsAvailableSelectOne}"/>
                            <f:validateLength minimum="2" />
                        </p:selectOneMenu>
                        <p:message for="tblNatilleraPersona" />

                        <h:outputLabel value="#{bundle.CreateTblPrestamoLabel_valorPrestamo}" for="valorPrestamo" />
                        <p:inputText id="valorPrestamo" value="#{tblPrestamoController.selected.valorPrestamo}" title="#{bundle.CreateTblPrestamoTitle_valorPrestamo}" required="true" requiredMessage="#{bundle.CreateTblPrestamoRequiredMessage_valorPrestamo}">
                            <f:validateLength minimum="2" />
                        </p:inputText>
                        <p:message for="valorPrestamo" />


                        <p:outputLabel value="#{bundle.CreateTblPrestamoLabel_fechaInicioCuota}" for="fechaInicioCuota" />
                        <p:calendar id="fechaInicioCuota" value="#{tblPrestamoController.selected.fechaInicioCuota}" title="#{bundle.CreateTblPrestamoTitle_fechaInicioCuota}" required="true" requiredMessage="#{bundle.CreateTblPrestamoRequiredMessage_fechaInicioCuota}" effect="fold" pattern="dd-MM-yyyy">
                            <f:validateLength minimum="2" />
                        </p:calendar>
                        <p:message for="fechaInicioCuota" /> 

                        <p:outputLabel value="#{bundle.CreateTblPrestamoLabel_cantidadCuotas}" for="cantidadCuotas" />
                        <p:inputText id="cantidadCuotas" value="#{tblPrestamoController.selected.cantidadCuotas}" title="#{bundle.CreateTblPrestamoTitle_cantidadCuotas}" required="true" requiredMessage="#{bundle.CreateTblPrestamoRequiredMessage_cantidadCuotas}">
                            <f:validateLength minimum="2" />
                        </p:inputText>
                        <p:message for="cantidadCuotas" />

                        <p:outputLabel value="#{bundle.CreateTblPrestamoLabel_interes}" for="interes" />
                        <p:inputText id="interes" value="#{tblPrestamoController.selected.interes}" title="#{bundle.CreateTblPrestamoTitle_interes}" required="true" requiredMessage="#{bundle.CreateTblPrestamoRequiredMessage_interes}">
                            <f:validateLength minimum="2" />
                        </p:inputText>
                        <p:message for="interes" />

                        <p:outputLabel value="#{bundle.CreateTblPrestamoLabel_interesMora}" for="interesMora" />
                        <p:inputText id="interesMora" value="#{tblPrestamoController.selected.interesMora}" title="#{bundle.CreateTblPrestamoTitle_interesMora}" />
                        <br/>
                        <p:outputLabel value="#{bundle.CreateTblPrestamoLabel_valorCuota}" for="valorCuota" />
                        <p:inputText id="valorCuota" value="#{tblPrestamoController.selected.valorCuota}" title="#{bundle.CreateTblPrestamoTitle_valorCuota}" required="true" requiredMessage="#{bundle.CreateTblPrestamoRequiredMessage_valorCuota}">
                            <f:validateLength minimum="2" />
                        </p:inputText>
                        <p:message for="valorCuota" />

                        <p:outputLabel value="#{bundle.CreateTblPrestamoLabel_periodicidad}" for="periodicidad" />
                        <p:selectOneMenu id="periodicidad" value="#{tblPrestamoController.selected.periodicidad}" required="true" requiredMessage="#{bundle.CreateTblPrestamoRequiredMessage_periodicidad}">
                            <h:selectOneMenu title="#{bundle.CreateTblPrestamoTitle_periodicidad}" />
                            <f:selectItems value="#{tblPeriodicidadController.itemsAvailableSelectOne}"/>
                            <f:validateLength minimum="2" />
                        </p:selectOneMenu>
                        <p:message for="periodicidad" />

                        <h:outputLabel value="#{bundle.CreateTblPrestamoLabel_estado}" for="estado" />
                        <p:selectOneMenu id="estado" value="#{tblPrestamoController.selected.estado}" required="true" requiredMessage="#{bundle.CreateTblPrestamoRequiredMessage_estado}">
                            <h:selectOneMenu title="#{bundle.CreateTblPrestamoTitle_estado}" />
                            <f:selectItems value="#{tblEstadoController.itemsAvailableSelectOne}"/>
                            <f:validateLength minimum="2" />
                        </p:selectOneMenu>
                        <p:message for="estado" />

                    </h:panelGrid>
                    <br />
                    <p:commandButton action="#{tblPrestamoController.create}" value="#{bundle.CreateTblPrestamoSaveLink}" update="panel"/>
                    <p:commandButton action="#{tblPrestamoController.prepareList}" value="#{bundle.CreateTblPrestamoShowAllLink}" immediate="true"/>
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
